echo 'Press enter to configure network'
read
sudo sed -i 's/^iface eth0 inet dhcp/#iface eth0 inet dhcp/g' /etc/network/interfaces
sudo sh -c "echo 'iface eth0 inet static' >> /etc/network/interfaces"
sudo sh -c "echo address $(/sbin/ifconfig eth0 | sed -n 's/inet addr:\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\).*/\1.\2.\3.\4/p')  >> /etc/network/interfaces"
sudo sh -c "echo netmask $(/sbin/ifconfig eth0 | sed -n 's/.*Mask:\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\).*/\1.\2.\3.\4/p')  >> /etc/network/interfaces"
sudo sh -c "echo network $(/sbin/ifconfig eth0 | sed -n 's/inet addr:\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\).*/\1.\2.\3.0/p')  >> /etc/network/interfaces"
sudo sh -c "echo broadcast $(/sbin/ifconfig eth0 | sed -n 's/.*Bcast:\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\).*/\1.\2.\3.\4/p')  >> /etc/network/interfaces"
sudo sh -c "echo gateway $(/sbin/route -n | sed -n 's/^0.0.0.0[[:blank:]]*[[:blank:]]\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\)\.\([[:digit:]]\{,3\}\).*/\1.\2.\3.\4/p')  >> /etc/network/interfaces"
echo 'Press enter to review network configuration'
read
sudo cat /etc/network/interfaces
echo 'Press enter to review hosts configuration'
read
sudo cat  /etc/hosts
echo 'Press enter to review dns configuration'
read
sudo cat  /etc/resolv.conf
echo 'Press enter key to restart network'
read
sudo /etc/init.d/networking restart
echo 'Done configure network'
